package com.trade.module.database.operation;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {

    public static String dateToString(Date time, String format) {
        SimpleDateFormat formatter = new SimpleDateFormat(format);
        return formatter.format(time);
    }

    public static Date stringToDate(String format, String dateStr)
            throws ParseException {
        SimpleDateFormat formatter;
        formatter = new SimpleDateFormat(format);
        return formatter.parse(dateStr);
    }

}
